package vim.meet.aspectj;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.curitis.annotation.RedisLock;
import org.springframework.stereotype.Component;

import java.util.Arrays;

@Aspect
@Component
public class RedisLockAspect {

    @Around("@annotation(redisLock)")
    public Object arount(ProceedingJoinPoint joinPoint, RedisLock redisLock) throws Throwable {
        Object[] args = joinPoint.getArgs();
        System.out.println(Arrays.toString(args));
        System.out.println("before");
        Object result = joinPoint.proceed();
        System.out.println("after");
        return result;
    }
}
